{% extends 'base.html' %}
{% import 'bootstrap/wtf.html' as wtf %}

{% block head %}
 {{ super() }}

   <link rel="stylesheet" href="{{ url_for('src.static', filename='pygments.css') }}" type="text/css" />
   <style>
        pre{
        white-space:pre-wrap;
        white-space:-moz-pre-wrap;
        white-space:-pre-wrap;
        white-space:-o-pre-wrap;
        word-wrap:break-word;
        }
        img{
            max-width:800px;
            text-align:center;
            margin:auto;
        }


   </style>

<!--
  <script language="javascript">
    function delcfm() {
        if (!confirm("确认要删除？")) {
            window.event.returnValue = false;
        }
    }
  </script>
-->

{% endblock%}


{% block title %} {{ vul_report.title }} {% endblock%}

{% block page_content %}


<div class="page-header">
	<h1>{{ vul_report.title }}</h1>

<div>
  {% if current_user.can('src.vul_report_delete') %}
    <a href="javascript:if(confirm('确实要删除该内容吗?'))location='{{ url_for('src.vul_report_delete', id=vul_report.id ) }}'" ><button type="button" class="btn btn-danger btn-lg">删除</button></a>
  {% endif %}

  {% if current_user.can('src.vul_report_admin_edit') %}
    <a href="{{ url_for('src.vul_report_admin_edit', id=vul_report.id ) }}" ><button type="button" class="btn btn-danger btn-lg">管理编辑</button></a>
  {% endif %}

  {% if current_user.can('src.vul_report_review') %}
    {% if (vul_report.vul_status == '未审核') %}
    <a href="{{ url_for('src.vul_report_review', id=vul_report.id ) }}"><button type="button" class="btn btn-danger btn-lg">审核</button></a>
    {% endif %}
  {% endif %}

  {% if current_user.can('src.vul_report_known') %}
    {% if (vul_report.vul_status == '已通告') %}
    <a href="javascript:if(confirm('是否已知悉漏洞详情?'))location='{{ url_for('src.vul_report_known', id=vul_report.id ) }}'"><button type="button" class="btn btn-danger btn-lg">请确认已知悉漏洞</button></a>
    {% endif %}
  {% endif %}


  {% if current_user.can('src.vul_report_dev_finish') %}
    {% if vul_report.vul_status == '修复中' or vul_report.vul_status == '暂不处理' %}
    <a href="{{ url_for('src.vul_report_send_email', id=vul_report.id) }}"><button type="button" class="btn btn-danger btn-lg">发送邮件</button></a>
    {% endif %}
  {% endif %}


  {% if current_user.can('src.vul_report_dev_finish') %}
    {% if vul_report.vul_status == '修复中' or vul_report.vul_status == '暂不处理' %}
    <a href="{{ url_for('src.vul_report_dev_finish', id=vul_report.id) }}"><button type="button" class="btn btn-danger btn-lg">申请复测</button></a>
    {% endif %}
  {% endif %}

  {% if current_user.can('src.vul_report_retest_result') %}
    {% if vul_report.vul_status == '复测中' %}
    <a href="{{ url_for('src.vul_report_retest_result', id=vul_report.id) }}"><button type="button" class="btn btn-danger btn-lg">提交复测结果</button></a>
    {% endif %}
  {% endif %}

  {% if current_user.can('src.vul_report_attack_check') %}
    {% if vul_report.vul_status != '未审核' %}
    <a href="{{ url_for('src.vul_report_attack_check', id=vul_report.id) }}"><button type="button" class="btn btn-danger btn-lg">提交攻击发现结果</button></a>
    {% endif %}
  {% endif %}

  {% if current_user.can('src.vul_report_vul_cata') %}
    {% if vul_report.vul_status != '未审核' %}
    <a href="{{ url_for('src.vul_report_vul_cata', id=vul_report.id) }}"><button type="button" class="btn btn-danger btn-lg">提交漏洞层面</button></a>
    {% endif %}
  {% endif %}

  {% if current_user.is_authenticated %}
    <a href="{{ url_for('src.vul_report_log', id=vul_report.id) }}"><button type="button" class="btn btn-danger btn-lg">查看漏洞日志</button></a>
  {% endif %}
</div>


</div>



<div class="page-header">
   <h3>漏洞概况</h3>
</div>
<div>
   <label>作者:</label> {{ vul_report.author }}<br>
   <label>时间:</label> {{ moment(vul_report.timestamp).format('YYYY年M月D日, H:mm:ss') }}<br>
   <label>受影响域名:</label> {{ vul_report.related_asset }}<br>
   <label>漏洞类型:</label> {{ vul_report.related_vul_type }}<br>
   <label>Rank:</label> {{ vul_report.grant_rank }}<br>
   {% if 0 < vul_report.risk_score <= 25 %}
   <label>风险等级: </label> 低
   {% elif 25 < vul_report.risk_score <= 50 %}
   <label>风险等级: </label> 中
   {% elif 50 < vul_report.risk_score <= 75 %}
   <label>风险等级: </label> 高
   {% elif 75 < vul_report.risk_score <= 100 %}
   <label>风险等级: </label> 严重
   {% endif %}
   <br>
   <label>开始时间:</label> {{ moment(vul_report.start_date).format('YYYY年M月D日') }}<br>
   <label>结束时间:</label> {{ moment(vul_report.end_date).format('YYYY年M月D日') }}<br>
</div>

<div class="page-header">
   <h3>漏洞证明</h3>
</div>
<div>
   {% if vul_report.vul_poc_html %}
   {{ vul_report.vul_poc_html|safe }}
   {% endif %}
</div>

<div class="page-header">
   <h3>解决方案</h3>
</div>
<div>
   {% if vul_report.vul_solution_html %}
   {{ vul_report.vul_solution_html|safe }}
   {% endif %}
</div>

  {% if current_user.can('src.vul_report_known') %}
    {% if (vul_report.vul_status == '已通告') %}
    <a href="javascript:if(confirm('是否已知悉漏洞详情?'))location='{{ url_for('src.vul_report_known', id=vul_report.id ) }}'"><button type="button" class="btn btn-danger btn-block">请确认已知悉漏洞</button></a>
    {% endif %}
  {% endif %}

  {% if current_user.can('src.vul_report_dev_finish') %}
    {% if vul_report.vul_status == '修复中' %}
    <a href="{{ url_for('src.vul_report_dev_finish', id=vul_report.id) }}"><button type="button" class="btn btn-danger btn-block">申请复测</button></a>
    {% endif %}
  {% endif %}

<br/>
<br/>
<br/>
<br/>
<br/>
<br/>

{% endblock %}

